import React from 'react';
import base64url from "base64url";
import { connect } from 'dva'
import { routerRedux } from 'dva/router';
import { DatePicker, List, WhiteSpace, Tabs, TextareaItem,ImagePicker,Button} from 'antd-mobile';
import styles from './rwadminister.less';
import { createForm } from 'rc-form';
import tp from '../../../assets/mine/ok.png';
import tp1 from '../../../assets/mine/wait.png';
import tp2 from '../../../assets/mine/rejected.png';



class rwadminister extends React.Component{
  constructor(props){
    super(props);
    this.state={
      files: [],//上传的图片
    }
  }

  //==发布任务
  //上传图片
  onChange = (files, type, index) => {
    console.log(files, type, index);
    this.setState({
      files,
    });
  }
  //开始时间改变
  startTimieOnChange = (date) => {
    console.log('onChange', date);
    this.setState({
      startTime: date
    });
  }
  //结束时间改变
  endTimieOnChange = (date) => {
    console.log('onChange', date);
    this.setState({
      endTime: date
    });
  }

  callback = (key) =>{
    console.log('callback', key);
  };

  handleTabClick = (key) =>{
    console.log('callback', key);
    if(key === '3'){
      this.props.dispatch(
        routerRedux.push({
          pathname: `/work/rwadminister/releasetask`
        })
      );
    }
  };

  //任务审核
  rwaudit = () =>{
    console.log('renwu');
    this.props.dispatch(
      routerRedux.push({
        pathname:"/work/rwadminister/rwaudit",
      })
    )
  };

  //审核未通过详情
  rwRejected = () =>{
    console.log('renwu');
    this.props.dispatch(
      routerRedux.push({
        pathname:"/work/rwadminister/rwrejectex",
      })
    )
  };

  render()
{

  return (
    <div className="rwadminister">
      <WhiteSpace size="lg"/>
      <Tabs
        defaultActiveKey="1"
        animated={true}
        swipeable={false}
        onTabClick={this.handleTabClick}>
        <Tabs.TabPane className="tab1" tab="待审核" key="1">
          <WhiteSpace size="lg"/>
          <div>
            {/*顶部空白，由于tabs固定不变*/}
            <div className={styles.tabsBlank}></div>
            {/*具体的发布第一条*/}
            <div className={styles.releaseBox} onClick={this.rwaudit}>
              <div className={styles.releaseTitle}>做好9月份工作报表</div>
              <div className={styles.releaseContent}>9月份已经接近尾声，请做好工作报表提交给领导</div>
              <img src={tp1} style={{width:'1.5rem',height:'0.9rem'}}/>
            </div>
            {/*具体的发布第一条*/}
            <div className={styles.releaseBox}>
              <div className={styles.releaseTitle}>互联网领域党建工作指导员制度</div>
              <div className={styles.releaseContent}>为进一步加强全区互联网领域党建工作，充分发挥</div>
              <img src={tp1} style={{width:'1.5rem',height:'0.9rem'}}/>
            </div>

          </div>
        </Tabs.TabPane>
        <Tabs.TabPane className="tab1" tab="已发布" key="2">
          <WhiteSpace size="lg"/>
          <div>
            {/*顶部空白，由于tabs固定不变*/}
            <div className={styles.tabsBlank}></div>
            {/*具体的发布第一条*/}
            <div className={styles.releaseBox} onClick={this.rwRejected}>
              <div className={styles.releaseTitle}>做好9月份工作报表</div>
              <div className={styles.releaseContent}>9月份已经接近尾声，请做好工作报表提交给领导</div>
              <img src={tp2} style={{width:'1.5rem',height:'0.9rem'}}/>
            </div>
            {/*具体的发布第一条*/}
            <div className={styles.releaseBox}>
              <div className={styles.releaseTitle}>互联网领域党建工作指导员制度</div>
              <div className={styles.releaseContent}>为进一步加强全区互联网领域党建工作，充分发挥</div>
              <img src={tp} style={{width:'1.5rem',height:'0.9rem'}}/>
            </div>
            {/*具体的发布第一条*/}
            <div className={styles.releaseBox}>
              <div className={styles.releaseTitle}>互联网领域党建工作指导员制度</div>
              <div className={styles.releaseContent}>为进一步加强全区互联网领域党建工作，充分发挥</div>
              <img src={tp} style={{width:'1.5rem',height:'0.9rem'}}/>
            </div>


          </div>
        </Tabs.TabPane>
        <Tabs.TabPane className="tab1" tab="发布任务" key="3">
        </Tabs.TabPane>
      </Tabs>
    </div>
  )
}
}


function mapStateToProps({RWadminister}) {
  return {RWadminister}
}
const rwadministerxx = createForm()(rwadminister);
export default connect(mapStateToProps)(rwadministerxx);
